<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="MasterPage.xhtml">
            <ui:define name="deSlide">

            </ui:define>
            <ui:define name="contents">
                <h:form>
                    <script type="text/javascript">
                        if("#{session.getAttribute("UserId")}" == null || "#{session.getAttribute("UserId")}" == ""){
                            window.location = "Login.xhtml";    
                        }
                    </script>
                    <c:if test="#{historyOrdersManager.displayMessage}">
                        <div class="DetailsAlbumMessage">
                            <c:if test="#{historyOrdersManager.typeMessage}">
                                <h5 class="DetailsAlbumMessageOutputLabel" style="color: white;">#{historyOrdersManager.message}</h5>
                            </c:if>
                            <c:if test="#{!historyOrdersManager.typeMessage}">
                                <h5 class="DetailsAlbumMessageOutputLabel" style="color: red;">#{historyOrdersManager.message}</h5>
                            </c:if>
                            #{historyOrdersManager.resetMessage()}
                        </div>
                    </c:if>
                    <table id="tbhistoty" width="775px" style=" padding: 0; margin: 0; margin-left: -40px; margin-top: -11px">
                        <tr>
                            <td colspan="7"><h3 class="DefaultCartH3">Order History</h3>

                            </td>
                        </tr>
                        <tr style="padding-bottom: 10px">
                            <th>CODE</th>
                            <th>Date Order</th>
                            <th>Total money</th>
                            <th>Status</th>
                        </tr>
                        <ui:repeat value="#{historyOrdersManager.listOrder()}" var="listOrder">
                            <tr>
                                <td align="center">#{listOrder.orderID}</td>
                                <td align="center"><a href="DetailsHistoryOrder.xhtml?id=#{listOrder.orderID}">#{listOrder.orderDate}</a></td>
                                <td align="center">$#{listOrder.totalMoney}</td>
                                <h:outputLabel escape="false" value="#{historyOrdersManager.checkStatus(listOrder.orderID, listOrder.shipStatus)}"></h:outputLabel>
                            </tr>
                        </ui:repeat>
                    </table>
                    <style>
                        #tbhistoty tr td{
                            line-height: 2em;
                        }
                    </style>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

